﻿/**
 * @class app.ThreadDetail
 * @namespace app
 * @extends Ext.Panel
 */
app.ThreadDetail = function(configObj) {
    var thisObject = this;

    var topBar = new Ext.Toolbar({
        dock: 'top',
        title: '',
        items: [{
            text: 'Back',
            ui: 'back',
            handler: function() {
                app.eventMgr.fireEvent('BackToThreadList', null);
            }
        }]
    });

    app.ThreadDetail.superclass.constructor.call(this, {
        dockedItems: [ topBar ],
        layout: 'fit',
        tpl: new Ext.Template(
            '{html}'
        ),
        listeners: {
            'destroy': function(thisComponent) {
                app.eventMgr.un('SelectThread', selectForum);
            }
        }
    });

    function selectThread(threadId, threadName) {
        topBar.setTitle('Thread: ' + threadName);
        thisObject.update({
            'html': 'Not implemented!'
        });
        app.page.setActiveItem(3);
    }

    app.eventMgr.on('SelectThread', selectThread);
};
Ext.extend(app.ThreadDetail, Ext.Panel, {});